/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.zonasoft.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author JORGE
 */
@Entity
@Table(name = "candidato", catalog = "zonificacion", schema = "")
@NamedQueries({
    @NamedQuery(name = "Candidato.findAll", query = "SELECT c FROM Candidato c"),
    @NamedQuery(name = "Candidato.findByIdcandidato", query = "SELECT c FROM Candidato c WHERE c.idcandidato = :idcandidato"),
    @NamedQuery(name = "Candidato.findByNombre", query = "SELECT c FROM Candidato c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "Candidato.findByApellido", query = "SELECT c FROM Candidato c WHERE c.apellido = :apellido"),
    @NamedQuery(name = "Candidato.findByProfesion", query = "SELECT c FROM Candidato c WHERE c.profesion = :profesion"),
    @NamedQuery(name = "Candidato.findByTelefono", query = "SELECT c FROM Candidato c WHERE c.telefono = :telefono")})
public class Candidato implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idcandidato", nullable = false, length = 15)
    private String idcandidato;
    @Column(name = "nombre", length = 45)
    private String nombre;
    @Column(name = "apellido", length = 45)
    private String apellido;
    @Column(name = "profesion", length = 45)
    private String profesion;
    @Column(name = "telefono", length = 45)
    private String telefono;
    @JoinColumn(name = "ideleccion", referencedColumnName = "ideleccion")
    @ManyToOne
    private Eleccion ideleccion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idCandidato")
    private List<LiderCandidato> liderCandidatoList;

    public Candidato() {
    }

    public Candidato(String idcandidato) {
        this.idcandidato = idcandidato;
    }

    public String getIdcandidato() {
        return idcandidato;
    }

    public void setIdcandidato(String idcandidato) {
        this.idcandidato = idcandidato;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getApellido() {
        return apellido;
    }

    public void setApellido(String apellido) {
        this.apellido = apellido;
    }

    public String getProfesion() {
        return profesion;
    }

    public void setProfesion(String profesion) {
        this.profesion = profesion;
    }

    public String getTelefono() {
        return telefono;
    }

    public void setTelefono(String telefono) {
        this.telefono = telefono;
    }

    public Eleccion getIdeleccion() {
        return ideleccion;
    }

    public void setIdeleccion(Eleccion ideleccion) {
        this.ideleccion = ideleccion;
    }

    public List<LiderCandidato> getLiderCandidatoList() {
        return liderCandidatoList;
    }

    public void setLiderCandidatoList(List<LiderCandidato> liderCandidatoList) {
        this.liderCandidatoList = liderCandidatoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcandidato != null ? idcandidato.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Candidato)) {
            return false;
        }
        Candidato other = (Candidato) object;
        if ((this.idcandidato == null && other.idcandidato != null) || (this.idcandidato != null && !this.idcandidato.equals(other.idcandidato))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.zonasoft.enridades.Candidato[idcandidato=" + idcandidato + "]";
    }

}
